<template>
    <!-- 提交和重置按钮 -->
    <div class="form-btn-group">
        <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
            >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
            >重置</el-button
        >
        <div
            v-if="collapse.need"
            class="btn-collapse"
            :class="{ show: collapse.show }"
        >
            <div class="line" @click="collapse.show = !collapse.show">
                <i class="el-icon-arrow-down"></i>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: ["collapse"],
    created() {
    },
    methods: {
        handleQuery() {
            this.$emit("search");
        },
        resetQuery() {
            this.$emit("reset");
            this.$parent;
        },
    },
};
</script>

<style lang="scss" scoped>
.form-btn-group {
    position: relative;
    padding-top: 15px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 200px;
    border-top: 1px solid #eaeaea;

    & > button {
        position: relative;
        z-index: 10;
    }

    .btn-collapse {
        position: absolute;
        top: 0;
        z-index: 10;
        width: 100%;
        .line {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            margin: auto;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 80px;
            height: 20px;
            font-size: 12px;
            border: 1px solid #eaeaea;
            border-top: none;
            border-bottom-left-radius: 3px;
            border-bottom-right-radius: 3px;
            cursor: pointer;
            i {
                color: #999;
            }
        }

        &.show {
            top: 0;
            .line {
                i {
                    display: inline-block;
                    transform: rotate(180deg);
                }
            }
        }
    }
}
</style>
